package com.atguigu.lease.common.minio;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/*$$$
  @Author:bai
  @CreateTime:2024/11/6 /11:48
  $$$
*/
@Configuration
@EnableConfigurationProperties(MinioProperties.class)
public class MinioConfiguration {

    @Autowired
    private MinioProperties minioproperties;

    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder().endpoint(
                minioproperties.getEndpoint()).credentials(minioproperties.getAccessKey(),
                minioproperties.getSecretKey()).build();
    }
}
